package com.woniuxy.propertyjava.service.impl;

import com.woniuxy.propertyjava.dao.RegisteredDao;
import com.woniuxy.propertyjava.dao.ShopMessageDao;
import com.woniuxy.propertyjava.entity.PageBean;
import com.woniuxy.propertyjava.entity.Registered;
import com.woniuxy.propertyjava.entity.ShopMessage;
import com.woniuxy.propertyjava.service.RegisteredService;
import com.woniuxy.propertyjava.service.ShopMessageService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class ShopMessageServiceImpl implements ShopMessageService {

    @Resource
    ShopMessageDao shopMessageDao;

    //根据id查询数据
    @Override
    public ShopMessage getqueryById(Integer sid) {
        return this.shopMessageDao.queryById(sid);
    }

    //分页查询
    @Override
    public PageBean<ShopMessage> getqueryAllShopByLimit(ShopMessage shopMessage,int pageIndex, int pageSize) {
        PageBean<ShopMessage> pageBean=new PageBean<>();
        pageBean.setBeanList(shopMessageDao.queryAllShopByLimit(shopMessage,pageIndex,pageSize));
        pageBean.setPageIndex(pageIndex);
        pageBean.setPageSize(pageSize);
        pageBean.setTotalRecode(shopMessageDao.count());
        return pageBean;
    }

    //添加
    @Override
    public void getinsert(ShopMessage shopMessage) {
        shopMessageDao.insert(shopMessage);
    }

    //删除
    @Override
    public void getdeleteById(Integer sid) {
        shopMessageDao.deleteById(sid);
    }

    //修改
    @Override
    public void getupdate(ShopMessage shopMessage) {
        shopMessageDao.update(shopMessage);
    }

}
